package com.ruoyi.net.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.net.mapper.ElementSrSrtpMapper;
import com.ruoyi.net.domain.ElementSrSrtp;
import com.ruoyi.net.service.IElementSrSrtpService;

/**
 * 网元-SR-srtpService业务层处理
 * 
 * @author net
 * @date 2024-11-17
 */
@Service
public class ElementSrSrtpServiceImpl implements IElementSrSrtpService 
{
    @Autowired
    private ElementSrSrtpMapper elementSrSrtpMapper;

    /**
     * 查询网元-SR-srtp
     * 
     * @param id 网元-SR-srtp主键
     * @return 网元-SR-srtp
     */
    @Override
    public ElementSrSrtp selectElementSrSrtpById(String id)
    {
        return elementSrSrtpMapper.selectElementSrSrtpById(id);
    }

    /**
     * 查询网元-SR-srtp列表
     * 
     * @param elementSrSrtp 网元-SR-srtp
     * @return 网元-SR-srtp
     */
    @Override
    public List<ElementSrSrtp> selectElementSrSrtpList(ElementSrSrtp elementSrSrtp)
    {
        return elementSrSrtpMapper.selectElementSrSrtpList(elementSrSrtp);
    }

    /**
     * 新增网元-SR-srtp
     * 
     * @param elementSrSrtp 网元-SR-srtp
     * @return 结果
     */
    @Override
    public int insertElementSrSrtp(ElementSrSrtp elementSrSrtp)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(elementSrSrtp.getId())) {
            elementSrSrtp.setId(uuid);
        }
        elementSrSrtp.setCreateBy(SecurityUtils.getUsername());
        elementSrSrtp.setCreateTime(DateUtils.getNowDate());
        elementSrSrtp.setUpdateBy(SecurityUtils.getUsername());
        elementSrSrtp.setUpdateTime(DateUtils.getNowDate());
        return elementSrSrtpMapper.insertElementSrSrtp(elementSrSrtp);
    }

    /**
     * 修改网元-SR-srtp
     * 
     * @param elementSrSrtp 网元-SR-srtp
     * @return 结果
     */
    @Override
    public int updateElementSrSrtp(ElementSrSrtp elementSrSrtp)
    {
        elementSrSrtp.setUpdateBy(SecurityUtils.getUsername());
        elementSrSrtp.setUpdateTime(DateUtils.getNowDate());
        return elementSrSrtpMapper.updateElementSrSrtp(elementSrSrtp);
    }

    /**
     * 批量删除网元-SR-srtp
     * 
     * @param ids 需要删除的网元-SR-srtp主键
     * @return 结果
     */
    @Override
    public int deleteElementSrSrtpByIds(String[] ids)
    {
        return elementSrSrtpMapper.deleteElementSrSrtpByIds(ids);
    }

    /**
     * 删除网元-SR-srtp信息
     * 
     * @param id 网元-SR-srtp主键
     * @return 结果
     */
    @Override
    public int deleteElementSrSrtpById(String id)
    {
        return elementSrSrtpMapper.deleteElementSrSrtpById(id);
    }
}
